<!--
 * @Descripttion: 多行输入框
 * @Author: zhoujj
 * @Date: 2021-07-02 08:56:51
 * @LastEditors: zhoujj
 * @LastEditTime: 2021-07-07 09:39:27
-->
<template>
  <div v-if="item">
    <el-form ref="form" :rules="rules" :model="form" label-width="120px">
      <el-form-item :label="item.title" prop="value">
        <el-input
          type="textarea"
          :rows="2"
          :placeholder="item.msg"
          v-model="form.value"
        >
        </el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  props: ["item", "number"],
  watch: {
    "form.value"(v, o) {
      this.$emit("changeComponent", {
        number: this.number,
        type: this.item.type,
        value: this.form.value,
      });
    },
  },
  data() {
    return {
      form: {
        value: "",
      },
      rules: {
        value: [
          { required: this.item.must, message: this.item.msg, trigger: "blur" },
        ],
      },
    };
  },
  mounted() {
    this.form = {
      ...this.form,
      ...this.item,
    };
  },
};
</script>

<style></style>
